package com.wang.gulimall.order.fallback;


import com.wang.common.exception.BizCodeEnum;
import com.wang.common.utils.R;
import com.wang.gulimall.order.feign.WareFeignService;
import com.wang.gulimall.order.vo.WareSkuLockVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description:
 * @Created: with IntelliJ IDEA.
 * @author: 夏沫止水
 * @createTime: 2020-07-13 14:45
 **/

@Slf4j
@Component
public class WareFeignServiceFallBack implements WareFeignService {


    @Override
    public R getSkuHasStock(List<Long> skuIds) {
        log.error("调用sentinel的降级策略");
        //   TO_MANY_REQUEST(10002,"请求流量过大，请稍后再试"),
        return R.error(BizCodeEnum.TO_MANY_REQUEST.getCode(), BizCodeEnum.TO_MANY_REQUEST.getMessage());
    }

    @Override
    public R getFare(Long addrId) {
        log.error("调用sentinel的降级策略");
        return R.error(BizCodeEnum.TO_MANY_REQUEST.getCode(), BizCodeEnum.TO_MANY_REQUEST.getMessage());
    }

    @Override
    public R orderLockStock(WareSkuLockVo vo) {
        log.error("调用sentinel的降级策略");
        return R.error(BizCodeEnum.TO_MANY_REQUEST.getCode(), BizCodeEnum.TO_MANY_REQUEST.getMessage());
    }
}
